// import Vue from 'vue'   //引入Vue
import {
	createRouter,
	createWebHashHistory
} from 'vue-router' //引入vue-router

import home from '../views/home.vue'
import login from '../views/login.vue'
import index from '../views/index.vue'
import student_list from '../views/student_list.vue'
import set from '../views/set.vue'

const routes = [
	{
		path: '',
		redirect: "home"
	},
	{
		path: '/',
		redirect: "home"
	},
	{
		path: '/login',
		name: 'login',
		component: login,
		meta: {
			title: '登录'
		}
	},
	{
		path: '/home',
		name: 'home',
		component: home,
		/* 子路由 */
		children: [{
			path: '/',
			redirect: "index"
		}, {
			path: '',
			redirect: "index"
		}, {
			path: '/index',
			name: 'index',
			component: index,
			meta: {
				title: '首页',
				isTab: true
			}
		},
		{
			path: '/student_list',
			name: 'student_list',
			component: student_list,
			meta: {
				title: '学生列表',
				isTab: true
			}
		},
		{
			path: '/set',
			name: 'set',
			component: set,
			meta: {
				title: '设置',
				isTab: true
			}
		}
		]
	}
];

const router = createRouter({
	//mode: 'hash',三张模式：hash|history|abstract，默认hash
	history: createWebHashHistory(),
	routes
})
export default router;
